package com.sunrate.investingquote.dao.router;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sunrate.investingquote.bean.router.ChannelPriorityConfig;
import com.sunrate.investingquote.mapper.router.ChannelPriorityConfigMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yyh
 * @description:
 * @date 2023/06/29/ 16:31
 */
@Service
public class ChannelPriorityConfigDao extends ServiceImpl<ChannelPriorityConfigMapper, ChannelPriorityConfig> {

    public List<ChannelPriorityConfig> listByStatus(int status) {
        LambdaQueryWrapper<ChannelPriorityConfig> wrapper = Wrappers.lambdaQuery(ChannelPriorityConfig.class)
                .eq(ChannelPriorityConfig::getStatus, status)
                .orderByDesc(ChannelPriorityConfig::getSortNum);
        return baseMapper.selectList(wrapper);
    }
}
